# serial_client.py
import serial
import time

def main():
    ser = serial.Serial('/tmp/ttyV0', baudrate=9600, timeout=1)
    time.sleep(2)  # 给串口一点初始化时间

    command = "HELLO\n"
    print(f"发送指令: {command.strip()}")
    ser.write(command.encode('utf-8'))

    response = ser.readline().decode('utf-8').strip()
    print(f"收到回复: {response}")

if __name__ == '__main__':
    main()
